package com.lunatic.assistant.service.impl;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import org.springframework.stereotype.Service;

@Service
public class MockOrderService {
    public Response getOrder(Request request) {
        String productName = "尤尼克斯羽毛球拍";
        return new Response(String.format("%s的订单编号为%s, 购买的商品为: %s", request.userId, request.orderId, productName));
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    public record Request(
            //这里的JsonProperty将转换为function的parameters信息, 包括参数名称和参数描述等
            /*
             {
                "orderId": {
                    "type": "string",
                    "description": "订单编号, 比如1001***"
                    },
                "userId": {
                    "type": "string",
                    "description": "用户编号, 比如2001***"
                }
            }
            */
            @JsonProperty(required = true, value = "orderId") @JsonPropertyDescription("订单编号, 比如1001***") String orderId,
            @JsonProperty(required = true, value = "userId") @JsonPropertyDescription("用户编号, 比如2001***") String userId) {
    }

    public record Response(String description) {
    }
}
